<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>GoogleMap</title>
    <script type="text/javascript" src="./vendor/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="http://ditu.google.cn/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAira30FR5tVprWCJ-8_WcqxR1W14e20gxBFMhpdYy_DdVp1kFtxRWRHe9GdvI1k4SY4byafCUQjpwZw"></script>
</head>
<body>
    <div id="mapContainer" style="width: 400px;height: 400px;"></div>
    <script type="text/javascript">
        $(function(){
            initMap();
        });
        function initMap() {
            //GBrowserIsCompatible()确定Api能否兼容当前浏览器
            if (GBrowserIsCompatible()) {
                //在ID为"Gmap"的层内显示地图
                var map = new GMap2(document.getElementById("mapContainer"));
                //设置地图中心点和缩放级别
                map.setCenter(new GLatLng(36.09778, 120.37236), 12);
                //地址解析getLocations
                var geocoder = new GClientGeocoder();
                geocoder.getLocations('塘桥', function (response) {
                    place = response.Placemark[0];
                    point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
                    marker = new GMarker(point);
                    map.addOverlay(marker);
                    marker.openInfoWindowHtml(getGeocodeHtml(response));
                });
            }
        }

        //组装冒泡内的HTML数据
        function getGeocodeHtml(response) {
            pname = response.name;
            paddress = response.Placemark[0].address;
            plat = response.Placemark[0].Point.coordinates[1];
            plon = response.Placemark[0].Point.coordinates[0];
            return ("地点：" + pname + "<br />位置：" + paddress + "<br />坐标：" + plat + "," + plon);
        };
    </script>
</body>
</html>